home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Packmags
/
NewsFlash - Issue 07 (1990-01)(UGA - 17-Bit Software)(Disk 1 of 2)[a intro].zip
/
NewsFlash - Issue 07 (1990-01)(UGA - 17-Bit Software)(Disk 1 of 2)[a intro].adf
/
sources
/
Bobs.S
next >
Wrap
Text File
|
1996-12-24
|
9KB
|
313 lines
; Scroller+Bobs
; (C)1989 by Brian Postma
; J.v.Hartenstraat 51
; 7576VX Oldenzaal (NL)
; Tel:05410-14763
start: movem.l d0-d7/a0-a6,-(a7)
bsr initcop ;Init CopperList
lea gfxname,a1 ;Name of graphics library
move.l 4,a6 ;Execbase
jsr -132(a6) ;Forbid->No Multitasking
jsr -408(a6) ;Open Library
move.l d0,gfxbase ;Rememer graphics base
lea intname,a1 ;Name of intuition lib.
jsr -408(a6) ;Open Library
move.l d0,intbase ;Remember intuition base
move.l intbase,a6
lea osargs,a0 ;Pointer to newscreen struct.
jsr -198(a6) ;Open Screen
move.l d0,screenbase ;Pointer to screen struct
beq quit ;Could I open it ??
add.l #84,d0 ;Screenbase+84
move.l d0,rastport ;Is Rastport
move.l gfxbase,a6
move.l rastport,a1
clr.l d0 ;Color=0
jsr -234(a6) ;Setrast->Clear Screen
move.l screenbase,a0
move.l 192(a0),d0 ;Pointer to first bitplane
move.w d0,planes+6 ;Low word in copperlist
swap d0
move.w d0,planes+2 ;High word in copperlist
move.l gfxbase,a0 ;gfxbase+$32=pointer to clist
move.l $32(a0),oldcop ;save old copperlist
move.l #newcop,$32(a0) ;My own copperlist
move.l $6c,oldirq ;Save old VBL irq pointer
move.l #newirq,$6c ;my VBL interrupt
wait: btst #6,$bfe001 ;Left mouse button pressed ??
bne wait ;No !!
move.l oldirq,$6c ;Restore interrupt
move.l gfxbase,a0 ;restore
move.l oldcop,$32(a1) ;old copperlist
move.l intbase,a6
move.l screenbase,a0
jsr -66(a6) ;Close the screen
move.l 4,a6
jsr -138(a6) ;Permit->Multitasking on
quit: movem.l (a7)+,d0-d7/a0-a6
rts
initcop:move.l #bobsplane,d0
move.l #bobsplane+40,d1
move.w d0,pl+6 ;put bobsplane
swap d0 ;pointers
move.w d1,pl+14 ;in copperlist
swap d1
move.w d0,pl+2
move.w d1,pl+10
rts
newirq: movem.l d0-d7/a0-a6,-(a7);Save regs
bsr bounce
bsr bobs
bsr scroll
movem.l (a7)+,d0-d7/a0-a6;Restore regs
dc.w $4ef9 ;Code for 'JUMP'
oldirq: dc.l 0 ;Jump to oldirq
scroll: move.l gfxbase,a6
move.l #2,d0 ;dx, 2 pixels to the left
clr.l d1 ;dy
move.l #0,d2 ;min x
move.l #0,d3 ;min y
move.l #383,d4 ;max x
move.l #15,d5 ;max y
move.l rastport,a1 ;rastport pointer
jsr -396(a6) ;ScrollRaster
subq.w #1,scrcount ;Counter for newtext
beq newtext ;is zero->new char
rts ;else->bye ??
newtext:move.w #5,scrcount ;newtext delay set
move.l gfxbase,a6
move.l rastport,a1
move.l #374,d0 ;x
move.l #8,d1 ;y
jsr -240(a6) ;move
move.l stringpointer,a0;pointer to string
move.l #1,d0 ;1 char
jsr -60(a6)
addq.l #1,stringpointer;Next char
cmpi.l #endstring,stringpointer
bne notend ;end of string reached
move.l #string,stringpointer;Start al over
notend: rts
bouncepointer: dc.l bouncedat
bouncey: dc.w 0
bounce: addq.l #1,bouncepointer
cmpi.l #endbdat,bouncepointer
bne not_end
move.l #bouncedat,bouncepointer
not_end:move.l bouncepointer,a0
move.b (a0),bouncey+1
rts
bobs: move.l #7,d7 ;8 bobs
lea xy,a1 ;coord of bobs
loop1: move.w (a1),d0 ;get x coord
move.w 2(a1),d1 ;get y coord
move.w #$0900,d2 ; Clear old
bsr blit ;blit it
addq.l #8,a1 ;next bob
dbra d7,loop1 ;loop
move.l #7,d7 ;8 bobs
lea xy,a1 ;coord
loop: add.w #k1,4(a1) ;next pos in sine
add.w #k2,6(a1) ;next pos
and.w #255,4(a1) ;256 bytes of data
and.w #255,6(a1) ;in sine
lea bobsine,a0
move.w 4(a1),d3
clr.w d0
clr.w d1
move.b (a0,d3.w),d0 ;new x coord
add.w #70,d0 ;Center it
move.w 6(a1),d3
move.b (a0,d3.w),d1 ;new y coord
add.w #14,d1 ;Center it
lsl.w #1,d1 ;x2 coz 2 bitplanes
add.w bouncey,d1
move.w d0,(a1) ;save coord
move.w d1,2(a1)
move.w #$0dfc,d2 ;blit on
bsr blit ;blit it
addq.l #8,a1
dbra d7,loop
rts
; Blit Routine X coord in d0
; Y coord in d1
; blitmode in d2
blit: movem.l d0-d7/a0-a6,-(a7)
cmpi.w #380,d1
blt is_fine
move.w #380,d1
is_fine:bsr waitblt ;blitter still in use
clr.l d7
move.w d0,d7 ;calculate
and.w #15,d0 ;all
lsl.w #8,d0 ;blitter
lsl.w #4,d0 ;data
or.w d0,d2 ;from x
move.w d2,$dff040 ;and
lsr.l #4,d7 ;y
lsl.l #1,d7 ;coord
move.l #bobsplane,d2
add.l d7,d2
mulu #40,d1 ;40 is screenwidth
add.l d1,d2
move.w #0,$dff042 ;BLTCON0
move.l #$ffff0000,$dff044 ;BLTMASK
move.l #dat,$dff050 ;BLTBDAT
move.l d2,$dff04c ;BLTADAT
move.l d2,$dff054 ;BLTDDAT
move.w #-2,$dff064 ;BLTBMOD
move.w #36,$dff062 ;BLTAMOD
move.w #36,$dff066 ;BLTDMOD
move.w #32*64+2,$dff058
bsr waitblt
movem.l (a7)+,d0-d7/a0-a6
rts
waitblt:btst #14,$dff002
bne waitblt
rts
k1 = 1
k2 = 1
cx = 32
cy = 32
k = 64
xy: dc.w 0,0,0,k
dc.w 0,0,cx,cy+k
dc.w 0,0,2*cx,2*cy+k
dc.w 0,0,3*cx,3*cy+k
dc.w 0,0,4*cx,4*cy+k
dc.w 0,0,5*cx,5*cy+k
dc.w 0,0,6*cx,6*cy+k
dc.w 0,0,7*cx,7*cy+k ;coord and pos of bobs
newcop: dc.w $0092,$0038,$0094,$00d0 ;DFFSTART,DFFSTOP->Normal
dc.w $008e,$296a,$0090,$29fa ;DIWSTART,DIWSTOP
dc.w $0096,$0020,$0100,$0000 ;Sprites off,planes off
dc.w $0108,$0028,$010a,$0028 ;BPL1MOD,BPL2MOD
dc.w $0180,$0000,$0182,$0e45
dc.w $0184,$0b22,$0186,$0800 ;Colors
pl: dc.w $00e0,$0000,$00e2,$0000 ;Bitplane 1 pointers
dc.w $00e4,$0000,$00e6,$0000 ;Bitplane 2 pointers
dc.w $3001,$fffe ;wait till line 48 = $30
dc.w $0100,$2000 ;2 bitplanes on
dc.w $ff01,$fffe ;wait till line 255= $ff
dc.w $0100,$0000 ;all bitplanes of
dc.w $ffdf,$fffe ;wait till last NTSC line
dc.w $0092,$0028,$0094,$00d8 ;DFFSTART,DFFSTOP->OverScan
dc.w $0108,$0002,$010a,$0002 ;BPL1MOD,BPL2MOD
dc.w $0180,$0000,$0182,$0f00 ;Colors
planes: dc.w $00e0,$0000,$00e2,$0000 ;Plane1 low,high word
dc.w $0001,$fffe ;Wait till line 80 reached
dc.w $0100,$1000 ;Bitplane 1 on
dc.w $0107,$fffe,$0182,$0f11
dc.w $0207,$fffe,$0182,$0f22
dc.w $0307,$fffe,$0182,$0f33
dc.w $0407,$fffe,$0182,$0f44
dc.w $0507,$fffe,$0182,$0f55
dc.w $0607,$fffe,$0182,$0f66
dc.w $0707,$fffe,$0182,$0f77
dc.w $0807,$fffe,$0182,$0f88
dc.w $0907,$fffe,$0182,$0f99
dc.w $0a07,$fffe,$0182,$0faa
dc.w $0b07,$fffe,$0182,$0fbb
dc.w $0c07,$fffe,$0182,$0fcc
dc.w $0d07,$fffe,$0182,$0fdd
dc.w $0e07,$fffe,$0182,$0fee
dc.w $0f07,$fffe,$0182,$0fff ;Color changes in scroll
dc.w $1001,$fffe ;Wait till line 208 reached
dc.w $0100,$0000 ;Bitplanes off
dc.w $0180,$0000 ;background=black
dc.w $ffff,$fffe ;Wait till end
bobsplane:
blk.b 256*40*2,0 ;memory for the bob bitplane
osargs: dc.w 0,0,384,16 ;x-min,y-min,width,height
dc.w 1 ;depth 1 bitplane
dc.b 0,1 ;detailpen,blockpen
dc.w 0,15 ;viewmodes,type=customscreen
dc.l textattr,0 ;textattr,title=none
dc.l 0,0 ;gadgets,bitmap
textattr:
dc.l fontname ;Fontname
dc.w 9 ;fontsize
dc.b 0 ;Style=normal
dc.b 1 ;flags=romfont
scrcount: dc.w 1
oldcop: dc.l 0
gfxbase: dc.l 0
intbase: dc.l 0
rastport: dc.l 0
screenbase: dc.l 0
stringpointer: dc.l string
intname: dc.b "intuition.library",0
gfxname: dc.b "graphics.library",0
fontname: dc.b "topaz.font",0
string:
dc.b " THE TIMECIRCLE ... THIS NICE LITTLE BOB-BOUNCE-SCROLLER"
DC.B " WAS CREATED BY BRIAN POSTMA FOR THE UGA NEWSFLASH "
DC.B "MAGAZINE ...... "
endstring:
even
bobsine:
dc.b $50,$52,$54,$56,$58,$5A,$5C,$5E
dc.b $60,$62,$63,$65,$67,$69,$6B,$6D
dc.b $6F,$70,$72,$74,$76,$77,$79,$7B
dc.b $7C,$7E,$80,$81,$83,$84,$86,$87
dc.b $89,$8A,$8B,$8D,$8E,$8F,$90,$91
dc.b $93,$94,$95,$96,$97,$97,$98,$99
dc.b $9A,$9B,$9B,$9C,$9D,$9D,$9E,$9E
dc.b $9E,$9F,$9F,$9F,$A0,$A0,$A0,$A0
dc.b $A0,$A0,$A0,$A0,$A0,$9F,$9F,$9F
dc.b $9E,$9E,$9E,$9D,$9D,$9C,$9B,$9B
dc.b $9A,$99,$98,$97,$97,$96,$95,$94
dc.b $93,$91,$90,$8F,$8E,$8D,$8B,$8A
dc.b $89,$87,$86,$84,$83,$81,$80,$7E
dc.b $7C,$7B,$79,$77,$76,$74,$72,$70
dc.b $6F,$6D,$6B,$69,$67,$65,$63,$62
dc.b $60,$5E,$5C,$5A,$58,$56,$54,$52
dc.b $50,$4E,$4C,$4A,$48,$46,$44,$42
dc.b $40,$3E,$3D,$3B,$39,$37,$35,$33
dc.b $31,$30,$2E,$2C,$2A,$29,$27,$25
dc.b $24,$22,$20,$1F,$1D,$1C,$1A,$19
dc.b $17,$16,$15,$13,$12,$11,$10,$F
dc.b $D,$C,$B,$A,$9,$9,$8,$7
dc.b $6,$5,$5,$4,$3,$3,$2,$2
dc.b $2,$1,$1,$1,$0,$0,$0,$0
dc.b $0,$0,$0,$0,$0,$1,$1,$1
dc.b $2,$2,$2,$3,$3,$4,$5,$5
dc.b $6,$7,$8,$9,$9,$A,$B,$C
dc.b $D,$F,$10,$11,$12,$13,$15,$16
dc.b $17,$19,$1A,$1C,$1D,$1F,$20,$22
dc.b $24,$25,$27,$29,$2A,$2C,$2E,$30
dc.b $31,$33,$35,$37,$39,$3B,$3D,$3E
dc.b $40,$42,$44,$46,$48,$4A,$4C,$4E
dat:
dc.w $0,$0,$820,$FE0,$2008,$3FF8,$4C04
dc.w $73FC,$1800,$67FC,$9002,$EFFE,$0,$FFFE,$2
dc.w $FFFE,$2,$FFFE,$6,$FFFE,$6,$FFFE,$800C,$FFFC
dc.w $1C,$7FFC,$4038,$7FF8,$20F0,$3FF0,$BC0,$FC0
bouncedat:
dc.b 100,84,70,58,48,40,34,30,26,24,22,20,20
dc.b 18,18,16,16,14,14,14,12,12
dc.b 12,12,12,14,14,14,16,16
dc.b 18,18,20,20,22,24,26,30,34,40,48,58,70,84
endbdat: